#include "widget.h"
#include "ui_widget.h"
#include<QPaintEvent>
#include<QPainter>
#include<QPixmap>
#include<QCursor>
#include<QMetaEnum>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget),
      timer(new QTimer(this)),
      menu(new QMenu(this))
{
    ui->setupUi(this);

    this->setWindowFlag(Qt::FramelessWindowHint);
    this->setAttribute(Qt::WA_TranslucentBackground);

    this->installEventFilter(new DragFilter);

    connect(timer,&QTimer::timeout,[this](){
        static int index=0;
        auto paths=this->action_map.value(this->cur_role_act);
        this->cur_role_pix=paths[index++ % paths.size()];
        this->update();
  });

    initMenu();

    loadRoleActRes();

    showActAnimation(RoleAct::Swing);
}

